$:.unshift File.join(File.dirname(__FILE__),'..','lib')

require 'rubygems'
require 'roadrunner'
require 'active_record'
require 'pp'

session = {:adapter=>'sqlite3',:database=>File.join(File.dirname(__FILE__),'db','development.sqlite3')}

ActiveRecord::Base.establish_connection(
  session
)

class Scenario < ActiveRecord::Base
  has_many :transactions
end
class Transaction < ActiveRecord::Base
  belongs_to :scenario
  has_many :records
end
class Record < ActiveRecord::Base
  belongs_to :transaction
end

transaction = Transaction.new({:name=>'test_transaction01'})
r1 = Record.new
transaction.records << r1
r1.save!
transaction.save!